#ifndef _EPD_SES_266_H_
#define _EPD_SES_266_H_

#include "common.h"
#include "Cat_Fonts.h"
#include <nrf_gpio.h>
#include "board_epd2in6.h"
//#define EPD_PWR P0_0

//#define BUSY    P1_3
//#define RST     P2_0
//#define DC      P1_2
//#define CS      P0_1
//#define CLK     P0_5
//#define MOSI    P0_3

#define EPD_SCLK_L   nrf_gpio_pin_clear(EPD_SCLK)
#define EPD_SCLK_H   nrf_gpio_pin_set(EPD_SCLK)
#define EPD_SDI_H    nrf_gpio_pin_set(EPD_SDI)
#define EPD_SDI_L    nrf_gpio_pin_clear(EPD_SDI)

#define EPD_DC_H     nrf_gpio_pin_set(EPD_DC)
#define EPD_DC_L     nrf_gpio_pin_clear(EPD_DC)
#define EPD_CS_L     nrf_gpio_pin_clear(EPD_CS)     
#define EPD_CS_H     nrf_gpio_pin_set(EPD_CS)       
#define EPD_RST_L    nrf_gpio_pin_clear(EPD_RST)      
#define EPD_RST_H    nrf_gpio_pin_set(EPD_RST)  
#define EPD_READ_BUSY   nrf_gpio_pin_read(EPD_BUSY)

//#define EPD_2IN66_WIDTH       152
//#define EPD_2IN66_HEIGHT      296

// wf0213t50cz16 GDEW0213T5 212 x 104
#define EPD_2IN66_WIDTH       104
#define EPD_2IN66_HEIGHT      212

#define NEW_RAM   (0x01)
#define OLD_RAM   (0x02)

void DelayMS(uint msec);
void SendByte_softSPI(uint8 sdbyte);
void EPD_2IN66_SendCommand(uint8 cmd);
void EPD_2IN66_SendData(uint8 data);
void EPD_2IN66_SendData_Multi(const uint8 *data, uint16 data_size);
void _writeDataPGM(const uint8 *data, uint16 n, uint16 fill_with_zeroes);
void EPD_2IN66_ReadBusy(void);
void EPD_2IN66_Reset(void);
void EPD_2IN66_TurnOnDisplay(void);
void EPD_2IN66_TurnOnDisplayEX(void);
void EPD_2IN66_Init(void);
void EPD_2IN66_Init_Partial(void);
void EPD_2IN66_Clear(void);
void EPD_2IN66_part_Display(const uint8 *Image, uint8_t isold);
void EPD_2IN66_Display(uint8 *Image);
void EPD_2IN66_Sleep(void);
void EPD_DrawFonts(uint16 x, uint8 y_x8, uint8 gap, const char *str, const epdFONT_ascii *ascii_font,
                   const epdFONT_utf8 *utf8_font,uint8 ramX);
void EPD_draw(uint16 x, uint8 y_x8, uint16 x_size, uint8 y_size_x8, const uint8 *dat,uint8 ramX);
void EPD_SendData_Multi(const uint8 *data, uint16 data_size,uint8 Inverse);
void Draw_Battery(uint16_t x, uint8_t y, uint16_t max_voltage, uint16_t min_voltage, uint16_t voltage);
#endif
